//
//  OrderForm_Normal_Hv.swift
//  MikerShop
//
//  Created by eme on 2016/12/19.
//  Copyright © 2016年 eme. All rights reserved.
//

/*
 owner:cy
 update:2016年12月19日18:56:04
 info: 进货单cell 公司
 VC :  OrderForm_Vc
 */
import UIKit
import Kingfisher
import RxSwift
import RickonCore

class OrderForm_Normal_Hv: UITableViewCell {
    
    
   @IBOutlet weak var ischeck_Btn: UIButton!
    
    
    @IBOutlet weak var seperateLine_V: UIView!
    @IBOutlet weak var bdname_Lb: UILabel!
     private let disposeBag = DisposeBag()
    var updateBtnState_Closure:((Void)-> Void)?
    
    var item :OrderProductModel?{
        didSet{
            if let item = self.item {
                self.bdname_Lb.text = item.bdname
                self.ischeck_Btn.isSelected = item.allHasSelected
            }
        }
    }
    
    override func awakeFromNib() {
        self.seperateLine_V.backgroundColor = Theme.v.separate_Line
        self.ischeck_Btn
            .rx.tap
            .subscribe(onNext: { [unowned self] ( _ ) in
                self.item!.allHasSelected = !self.item!.allHasSelected
                if let updateBtnState_Closure = self.updateBtnState_Closure{
                    updateBtnState_Closure()
                }
            })
            .disposed(by: disposeBag)
        
    }
}

